//This file is part of SimpleReportingTool
//
//SimpleReportingTool is free software: you can redistribute it and/or modify
//it under the terms of the GNU Lesser General Public License as published by
//the Free Software Foundation, either version 3 of the License, or
//(at your option) any later version.
//
//SimpleReportingTool is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//GNU Lesser General Public License for more details.
//
//You should have received a copy of the GNU Lesser General Public License
//along with Foobar.  If not, see <http://www.gnu.org/licenses/>.




#ifndef __C_SIMPLE_REPORTING_TOOL_H_INCLUDE__
#define __C_SIMPLE_REPORTING_TOOL_H_INCLUDE__

#include <vector>
#include <string>
#include <mxml.h>

#include "IReportTarget.h"
#include "IDataSorcue.h"



using namespace std;

class cSimpleReportingTool
{
public:
	cSimpleReportingTool(void);

	int SetDataSource(const IDataSource* Data);

	int SetReportFile(const char* FileName);

	int SetReportXMLBuffer(const char* XMLbuffer);

	int Report(IReportTarget* ReportTarget);

	~cSimpleReportingTool(void);

	void DebugElement(mxml_node_t* nodeElement);

	const IDataSource* FindDataSourceByName(vector<const IDataSource*>* DataSource,const char* Name);

	const char* Version(void) {return "0.01";}
private:
	vector<const IDataSource*> Data;

	string XMLreport;

	IReportTarget* ReportTarget;

	int RenderStaticLabel(mxml_node_t* nodeElement, float StartHeight, float *Height);

	//int RenderDBLabel(mxml_node_t* nodeElement,const char* DataSource);
	int RenderDBLabel(mxml_node_t* nodeElement,const IDataSource* pDataSource, int RowN, float StartHeight, float *Height);

	int LoadLabelStyle(mxml_node_t* nodeElement,cText* Text);

};

#endif